package com.showapi.app.dynamic

import com.showapi.app.service.BaseService
import com.showapi.app.util.CommonUtil
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.context.ApplicationContext

public abstract class BaseHandler {
	static Logger log= LoggerFactory.getLogger(BaseService.class)

	ApplicationContext ctx	//这个属性在parseClass的时候被注入

	def tryBoolean= CommonUtil.&tryBoolean  //方法引用
	def removeProperty= CommonUtil.&removeProperty
	def copyProperty= CommonUtil.&copyProperty




	def propertyMissing(pName){
//		log.info "find property:  "+pName
		return ctx.getBean(pName)
	}
	def methodMissing(String name, def args) {
		throw new Exception("cant find method "+name)
	}

}
